package 剑指offer;

public class _33二叉搜索树的后序遍历序列 {
    public boolean verifyPostorder(int[] postorder) {
		return recur(postorder, 0, postorder.length-1);

    }
    public boolean recur(int []postorder,int start,int len) {
		if(start>=len) return true;
		int i=start;
		while(postorder[i]<postorder[len]) i++;
		int j=i;
		while(postorder[j]>postorder[len])j++;
		
		return j==len&&recur(postorder, 0, i-1)&&recur(postorder, i, len-1);
	}
}
